﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace He.Web.user
{
    public partial class _sidebar : System.Web.UI.UserControl
    {
        public Model.member Member = new Model.member();
        public Model.member_rank Rank = new Model.member_rank();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Request.IsAuthenticated)
            {
                FormsAuthentication.RedirectToLoginPage();
                return;
            }

            BLL.member mgr = new BLL.member();
            string username = HttpContext.Current.User.Identity.Name;
            if (mgr.Exists(username))
            {
                this.Member = mgr.GetModel(username);
                this.Rank = new BLL.member_rank().GetModel(Member.rank_id);
            }
            else
            {
                Response.Redirect("~/error.aspx?s=用户不存在");
            }
        }
    }
}